from os.path import join, basename
from application.flask import app
import glob

__avatars = ["/static/avatar/" + basename(f) for f in glob.glob(join(app.root_path, "static", "avatar", "*.jpeg"))]


def getRandomAvatar(token: str):
    l = len(__avatars)
    idx = hash(token) % l
    return __avatars[idx]
